*************************************************
* Purpose -- Creating figure to compare
* ever-treated vs never-treated states using 
* QCEW data
************************************************
clear all
* RUN 00_path_master.do FIRST TO GET FILEPATHS

************************************************
* Loading sample and cleaning
************************************************

use "$clean/qcew/qcew_annual_clean_state_fig_A1.dta", clear

gen epop55 = annual_avg_emplvl55/pop
gen lmw = ln(mw)
gen lepop55 = ln(epop55)

gen high_mw_tag = .
bys statefips (year): replace high_mw_tag = 1 if mw > mw[_n - 1] & mw > fed_mw
bys statefips (year): egen treat = max(high_mw_tag)
replace treat = 0 if mi(treat) & ~mi(mw)

frame copy default collapsed
frame change collapsed

collapse (mean) lmw lepop55 [aw=pop], by(treat year)
reshape wide lmw lepop55, i(year) j(treat)

foreach var in lmw lepop55 {
	gen `var'_dif = `var'1 - `var'0
}


************************************************
* Making figures
************************************************

twoway (line lepop55_dif year, lpattern(solid) lcolor(purple*0.7) yaxis(1)) ///
(line lmw_dif year, lpattern(solid) lcolor(dkgreen%30) yaxis(2)), ///
ytitle("Difference in log restaurant employment rate" "(Ever treated - never treated)", axis(1) color(purple*.7) size(medlarge)) ///
ytitle("Difference in log MW" "(Ever treated - never treated)", axis(2) color(dkgreen*.7) size(medlarge)) ///
ylabel(, axis(1) labsize(small)) ylabel(, axis(2) labsize(small)) ///
xlabel(1990(5)2020, labsize(small)) name(qes_emp, replace) ///
legend(pos(6) label(1 "Restaurant log employment") label(2 "Log MW") rows(1) size(medlarge)) ///
yline(0, lcolor(purple*0.7) lpattern(shortdash) axis(1)) yline(0, lcolor(dkgreen%30) lpattern(shortdash) axis(2)) ///
xtitle("")
graph export "$figures/Figure A1.pdf", replace


